import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

function _resolve(dir) {
  return path.resolve(__dirname, dir)
}

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {                // ← ← ← ← ← ←
    host: '0.0.0.0',    // ← 新增内容 ←
    port: '8888'
  },
  resolve: {
    // 别名
    alias: {
      '@': _resolve('src'),
    },
  },
  css: {
    preprocessorOptions: {
        less: {
            modifyVars: {
                hack: `true; @import (reference) "${path.resolve("src/style/base.less")}";`,
            },
            javascriptEnabled: true,
        },
    },
  }
})
